package com.example.soringbootwebsocket.demo2.controller;


import com.example.soringbootwebsocket.demo2.config.WebSocketTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.transform.Result;
import java.io.IOException;

@RestController
public class TestController {
    @Autowired
    WebSocketTest webSocketTest;
    @GetMapping("/sendMsage")
    public Result sendMsage(@RequestParam("userId") String userId, @RequestParam("msg") String msg){
        try {
            webSocketTest.sendMessage(userId,msg);
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("出现异常");
        }
        return  null;
    }
}
